package com.ihcil.forecast.demo.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

/**
 * Create by lotus on 2021/11/19 23:18
 */

@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private UserArgumentResolver userArgumentResolver;

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
        resolvers.add(userArgumentResolver);
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**").addResourceLocations("classpath:/static/", "classpath:/templates/");
        registry.addResourceHandler("/img/**").addResourceLocations("file:E:/ifstartjustcarryon/RadarPred/data0/",
                "file:E:/ifstartjustcarryon/RadarPred/data6/", "file:E:/ifstartjustcarryon/RadarPred/data12/");

//        WebMvcConfigurer.super.addResourceHandlers(registry);
    }

}
